package org.springframework.web.servlet.ajax.json;

/**
 * Testing your controller for AJAX-JSON behavior will be slightly easier if it
 * extends this class. During your test you'll simply subclass your controller
 * and provide appropriate overrides for the methods in this class. The
 * alternative is to pass a mocked JsonAjax and a mocked HttpServletRequest
 * (e.g. org.springframework.mock.web.MockHttpServletRequest) into the
 * AjaxContext at some point in your test class.
 * <p>
 * Note: We expect subclass to apply any required annotations, including @Controller
 * 
 * @author Charles Tassoni
 * 
 */
public class AjaxReadyController {
	
	public boolean isAjaxRequest(){
		return AjaxContext.isXHR();
	}
	
	public JsonAjax getJson(){
		return AjaxContext.getJson();
	}

}
